<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center zylx_flex_0_higd"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub zylx_fd0_0_higd'>
					<view class='flex flex-wrap align-center zylx_fd0_0_c0_higd' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  zylx_fd0_0_c0_c0_higd'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='zylx_fd0_0_c1_c0_higd'>{{$t('自由练习')}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end zylx_fd0_0_c0_higd'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center">
				<view>
					<benben-flex-tabs class-name='zylx_benbenTabsfd1_0_higd' v-model="tabsTypefd1_0"
						ref="benben_tabsfd1_0" select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0"
						:open-title-type='false' :open-sticky='true' :top='88' :is-show-content='false'
						:scrollspy='false' :tabs-info.sync="tabsInfofd1_0">

						<scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
							class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left="tabsInfofd1_0.moveX"
							scroll-with-animation="all .3s ease" :show-scrollbar='false' :enhanced="true">
							<view class="benben-tabs-content" id="benben_tabsfd1_0-content">
								<view id="benben_tabsfd1_0-title"
									class="benben-tabs-title flex flex align-center justify-around">
									<view
										:class="{ 'checkTitlefd1_0_higd': tabsTypefd1_0 == '1', 'flex flex-wrap align-center': true }"
										@tap="check(1)" :id="`benben_tabsfd1_0-title-item-${'1'}`">

										<text>{{$t('未练习')}}</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_0_higd': tabsTypefd1_0 == '2', 'flex flex-wrap align-center': true }"
										@tap="check(2)" :id="`benben_tabsfd1_0-title-item-${'2'}`">

										<text>{{$t('已练习')}}</text>

									</view>
								</view>
								<view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
									id="benben_tabsfd1_0-line"
									class="benben-tabs-line flex benben-flex-tabs-line zylx_linefd1_0_higd"
									:class="{'benben-tabs-line-active':tabsInfofd1_0.isInit}"></view>
							</view>
						</scroll-view>

					</benben-flex-tabs>

				</view>
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局2flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout zylx_flex_2_higd">
				<template v-for='(item,key0) in listData'>
					<view class='flex flex-direction align-stretch zylx_fd2_0_higd' :key='key0'>
						<view class='flex flex-wrap align-center justify-between zylx_fd2_0_c0_higd'>
							<view class='flex flex-wrap align-center'>
								<text class='zylx_fd2_0_c0_c0_c0_higd'>{{item.title}}</text>
							</view>
							<view class='flex flex-wrap align-center justify-center zylx_fd2_0_c0_c1_higd'
								v-if=" item.is_finish=='2'"  @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pagexxzx/jgym/jgym?type=1&id=${item.aid}`">
								<text class='zylx_fd2_0_c0_c1_c0_higd'>查看结果</text>
							</view>
							<view class='flex flex-wrap align-center justify-center zylx_fd2_0_c0_c2_higd'
								v-if=" item.is_finish=='1'" @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pagexxzx/lxdetail/lxdetail?type=1&aid=${item.aid}`">
								<text class='zylx_fd2_0_c0_c2_c0_higd'>开始练习</text>
							</view>
						</view>
						<view class='flex flex-direction align-stretch zylx_fd2_0_c1_higd'>
							<view class='flex flex-wrap align-center zylx_fd2_0_c0_higd'>
								<text class='zylx_fd2_0_c1_c1_c0_higd'>{{$t('所属课程：')}}</text>
								<text>{{item.name}}</text>
							</view>
							<view class='flex flex-wrap align-center zylx_fd2_0_c0_higd' v-if="item.is_finish==2">
								<text class='zylx_fd2_0_c1_c1_c0_higd'>答对题目：</text>
								<text>{{item.answer_num}} / {{item.total_num}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text class='zylx_fd2_0_c1_c1_c0_higd'>{{$t('创建时间：')}}</text>
								<text>{{item.create_time}}</text>
							</view>
						</view>
					</view>
				</template>
				
				<fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
					:listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
			</view>

			<!---flex布局2flex布局结束-->
			<view class="flex flex-wrap align-center justify-center benben-position-layout flex zylx_flex_3_higd" @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pagexxzx/cjlx/cjlx?type=1`">
				<view class='flex flex-wrap align-center justify-center zylx_fd3_0_higd'>
					<text class='zylx_fd3_0_c0_higd'>{{$t('创建练习')}}</text>
				</view>

			</view>
			<view :style="{height: '190rpx'}"></view>

		</view>
	</page-body>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"tabsInfofd1_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0,
					isInit: false
				},
				"tabsTypefd1_0": "1",
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"page": "1",
				"listData": []
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.diyPageListen()
		},
		onUnload() {
			this.diyOffPageListen()
		},
		onReady() {

		},
		onShow() {
			this.getbr8678b9588532Func()
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.getbr8678b9588532Func()
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//查询自由练习列表
			getbr8678b9588532Func() {
				this.minixPagingListsApi = global.apiUrls.post68678b9588532;
				this.pageingListApiMethod = 'get';
				this.allowOnloadGetList = false;
				this.pagingListPostDataContent = {
					is_finish: this.tabsTypefd1_0
				}
				this.listData = [];
				this.listData = this.listData;
				this.pagingListToggle();

			},
			check(index) {
				this.tabsTypefd1_0 = index
				this.getbr8678b9588532Func()
			},
			//页面监听
			diyPageListen() {
				uni.$on('lxadd', (data) => {
					this.getbr8678b9588532Func()
				});
				uni.$on('lxover', (data) => {
					this.getbr8678b9588532Func()
				});
			},
			//注销页面监听
			diyOffPageListen() {
				uni.$off('lxover');
				uni.$off('lxadd');
			},
			pagingListPostData() {
				return this.pagingListPostDataContent
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;

		.zylx_flex_3_higd {
			width: 750rpx;
			height: 190rpx;
			overflow: hidden;
			z-index: 10;
			bottom: calc(0rpx + var(--window-bottom));
			background: #FFFFFF;
			box-shadow: 0rpx -1rpx 0rpx 1rpx #EEEEEE;

			.zylx_fd3_0_higd {
				border: 1px solid #D32A29;
				background: #FFFFFF;
				width: 450rpx;
				height: 98rpx;
				border-radius: 49rpx;

				.zylx_fd3_0_c0_higd {
					font-size: 36rpx;
					color: rgba(211, 42, 41, 1);
				}
			}
		}

		.zylx_flex_2_higd {
			padding: 20rpx 32rpx 20rpx 32rpx;

			.zylx_fd2_0_higd {
				padding: 32rpx 24rpx 32rpx 24rpx;
				background: rgba(255, 255, 255, 1);
				background-size: 100% auto;
				border-radius: 16rpx;
				margin: 0rpx 0rpx 20rpx 0rpx;

				.zylx_fd2_0_c1_higd {
					background: #F8F8F8;
					width: 638rpx;
					// height: 146rpx;
					border-radius: 12rpx;
					padding: 24rpx;

					.zylx_fd2_0_c1_c1_c0_higd {
						color: rgba(112, 112, 112, 1);
					}
				}
			}
		}

		.zylx_fd2_0_c0_higd {
			margin: 0rpx 0rpx 24rpx 0rpx;

			.zylx_fd2_0_c0_c0_c0_higd {
				font-size: 36rpx;
				font-weight: 600;
			}

			.zylx_fd2_0_c0_c1_higd {
				margin: 0rpx 0rpx 0rpx 0rpx;
				width: 136rpx;
				height: 52rpx;
				line-height: 52rpx;
				border-radius: 26rpx;
				border: 1px solid #D32A29;

				.zylx_fd2_0_c0_c1_c0_higd {
					font-size: 24rpx;
					color: rgba(211, 42, 41, 1);
				}
			}

			.zylx_fd2_0_c0_c2_higd {
				margin: 0rpx 0rpx 0rpx 0rpx;
				background: #D32A29;
				width: 136rpx;
				height: 52rpx;
				border-radius: 26rpx;
				line-height: 52rpx;
				.zylx_fd2_0_c0_c2_c0_higd {
					font-size: 24rpx;
					color: var(--benbenFontColor3);
				}
			}
		}

		.zylx_fd2_0_c1_c0_c0_higd {
			color: #333;
		}

		.checkTitlefd1_0_higd {
			font-weight: 700 !important;
			font-size: 28rpx !important;
			color: #333 !important;
			background-color: rgba(255, 255, 255, 1) !important;
		}

		.zylx_linefd1_0_higd {
			width: 100rpx;
			height: 8rpx;
			top: 80rpx;
			background: #d53215;
			background-size: 100% auto !important;
		}

		.zylx_flex_0_higd {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;

			.zylx_fd0_0_higd {
				padding: 0rpx 32rpx 0rpx 32rpx;

				.zylx_fd0_0_c1_c0_higd {
					font-size: 36rpx;
					font-weight: 700;
					color: #333333;
					line-height: 50rpx;
				}
			}
		}

		.zylx_fd0_0_c0_higd {
			width: 120rpx;

			.zylx_fd0_0_c0_c0_higd {
				font-size: 36rpx;
				color: #333;
			}
		}
	}

	::v-deep .zylx_benbenTabsfd1_0_higd {
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		background: #fff;
		text-align: center;
	}
</style>
